<!DOCTYPE html>
<html lang="en" class="no-js" xmlns:th="http://www.thymeleaf.org" xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout" layout:decorator="layout">
<head>
    <title>搭配管理</title>
</head>
<body>
<div layout:fragment="content">

    <div class="row">
        <div class="table-toolbar col-md-12">
            <div class="table-toolbar col-md-12">
                <div class="btn-group pull-right"><a onclick="beforeSkip(this)" th:href="@{/promotion/combo/add}" id="Link_add" class="btn green">添加套餐<i class="fa fa-plus"></i></a></div>
            </div>
            <div class="col-md-15 col-sm-13">
                <form class="form-inline" th:action="@{/promotion/combo/index}" th:object="${comboSearch}"  method="post" name="form_submit" id="form_submit">


                    <div class="form-group">
                        <label class="sr-only" for="comboName">comboName</label>
                        <input type="text"  th:field="*{comboName}" placeholder="套餐名称"  id="comboName" class="form-control" />
                    </div>

                    <div class="form-group" >
                        <div class="col-md-4">
                            <input id="comboStartDate" name="comboStartDate" th:field="*{comboStartDate}" data-format="yyyy-MM-dd hh:mm:ss" placeholder="开始时间" class="form-control" type="text"/>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-md-4">
                            <input id="comboEndDate" name="comboEndDate" th:field="*{comboEndDate}" data-format="yyyy-MM-dd hh:mm:ss" placeholder="结束时间" class="form-control" type="text"/>
                        </div>
                    </div>
                    <div class="form-group">
					 			<label class="sr-only" for="status">brandType</label>
					 			<select th:field = "*{status}" id="status" style="width:200px;"  th:remove="none" class="form-control">
					                	<option value = "">全部</option>
					                	<option th:each="type : ${statusList}"					              
					                        	th:value="${type}" th:text="${type.description}">Credit card</option>
					            </select>
					 		</div>

                    <button type="button" id="bt_search" name="bt_search" class="btn green" onclick="checkDate();">
                        <i class="fa  fa-search"></i>
                    </button>
                </form>
            </div>
        </div>
    </div>

    <div class="row">
        <div class="col-md-12">
            <div id="div_combo_grid" th:include="promotion/combo/combo_table" >

            </div>
        </div>
    </div>
</div>
</body>
</html>

<script th:inline="javascript">
    /*<![CDATA[*/
    $("#comboStartDate").click(function(){
        WdatePicker({startDate:'%y-%M-01 00:00:00',dateFmt:'yyyy-MM-dd HH:mm:ss',alwaysUseStartDate:true,readOnly:true});
    }).focus(function () {
        WdatePicker({startDate:'%y-%M-01 00:00:00',dateFmt:'yyyy-MM-dd HH:mm:ss',alwaysUseStartDate:true,readOnly:true});
    });
    $("#comboEndDate").click(function(){
        WdatePicker({startDate:'%y-%M-01 00:00:00',dateFmt:'yyyy-MM-dd HH:mm:ss',alwaysUseStartDate:true,readOnly:true});
    }).focus(function () {
        WdatePicker({startDate:'%y-%M-01 00:00:00',dateFmt:'yyyy-MM-dd HH:mm:ss',alwaysUseStartDate:true,readOnly:true});
    });

    function beforeSkip(obj){
        obj.href = obj.href + '?'+$('.paging_bootstrap ul .active a').attr('href').split('?')[1];
    }
    function checkDate(){
        var startTime=$("#comboStartDate").val();
        var start=new Date(startTime.replace("-", "/").replace("-", "/"));
        var endTime=$("#comboEndDate").val();
        var end=new Date(endTime.replace("-", "/").replace("-", "/"));
        if(end <= start){
            alert("开始时间要小于结束时间");
            return  false;
        }
        $("#form_submit").submit();
    }


    /*]]>*/
</script>
